<template>
    <div class="navbar">
        <el-menu default-active="2"
                 class="el-menu-vertical-demo"
                 @open="handleOpen"
                 @close="handleClose"
                 :collapse="isCollapse"
                 background-color="#f8f8f9"
                 active-text-color="#0bb27a"
                 router>
            <template v-for="item in items">
                <el-menu-item :index="item.index">
                    <i :class="item.icon"></i>
                    <span slot="title">{{ item.title }}</span>
                </el-menu-item>
            </template>
        </el-menu>
    </div>
</template>

<script>
    export default {
        data() {
            return {
                isCollapse: false,
                items: [
                    {
                        icon: 'el-icon-location',
                        index: '/workbench',
                        title: '工作台'
                    },
                    {
                        icon: 'el-icon-menu',
                        index: '/user/userlist',
                        title: '员工管理'
                    },
                    {
                        icon: 'el-icon-document',
                        index: 'org',
                        title: '组织管理'
                    },
                    {
                        icon: 'el-icon-setting',
                        index: 'approval',
                        title: '审批'
                    }
                ]
            };
        },
        methods: {
            handleOpen(key, keyPath) {
                console.log(key, keyPath);
            },
            handleClose(key, keyPath) {
                console.log(key, keyPath);
            }
        }
    }
</script>

<style scoped>
    .el-menu-vertical-demo:not(.el-menu--collapse) {
        width: 180px;
        min-height: 400px;
    }

    .navbar {
        display: block;
        position: absolute;
        left: 0;
        top: 60px;
        bottom:0;
        overflow-y: scroll;
        overflow-x: hidden;
    }

    .navbar::-webkit-scrollbar{
        width: 0;
    }

    .navbar > ul {
        height:100%;
    }

    .navbar > ul > li:hover {
        background: #f2f2f2;
        color: #80848f;
        border-left-color: #59c993;
    }

    .app-18ym9_0 {
        position: fixed;
        display: block;
        left: 0;
        top: 0;
        padding-top: 60px;
        overflow-x: hidden;
        overflow-y: auto;
        z-index: 8;
        height: 100%;
        background: #f8f8f9;
        transition: all 0.5s;
    }

    .app-18ym9_0.fold-1gTe6_0 {
        transition: all 0.5s;
    }

    .app-18ym9_0.fold-1gTe6_0 i {
        margin-left: 10px;
    }

    .app-18ym9_0.fold-1gTe6_0 .avatar-3GX5d_0 {
        transition: all 0.5s;
        width: 30px;
        height: 30px;
    }

    .app-18ym9_0.fold-1gTe6_0 .nickname-1koul_0 {
        transition: all 0.5s;
        height: 0;
    }

    .app-18ym9_0.hasBulletin-1R_yy_0 {
        padding-top: 100px;
    }

    .app-18ym9_0::-webkit-scrollbar {
        width: 0;
    }

    .foldArea-aW7Qo_0 {
        display: -webkit-box;
        display: -ms-flexbox;
        display: flex;
        width: 100%;
        padding: 12px 12px 0;
        -webkit-box-pack: start;
        -ms-flex-pack: start;
        justify-content: flex-start;
    }

    .foldArea-aW7Qo_0 i {
        font-size: 16px;
        color: #bbbec4;
        transition: all 0.5s;
        cursor: pointer;
    }

    .foldArea-aW7Qo_0 i.active-1gkVX_0 {
        transition: all 0.5s;
        -webkit-transform: rotate(90deg);
        transform: rotate(90deg);
    }

    .foldArea-aW7Qo_0 i:hover {
        color: #59c993;
    }

    .info-1QsJ1_0 {
        display: -webkit-box;
        display: -ms-flexbox;
        display: flex;
        -webkit-box-orient: vertical;
        -webkit-box-direction: normal;
        -ms-flex-direction: column;
        flex-direction: column;
        padding: 16px 0;
        text-align: center;
        cursor: pointer;
        -webkit-box-align: center;
        -ms-flex-align: center;
        align-items: center;
    }

    .avatar-3GX5d_0 {
        display: inline-block;
        width: 48px;
        height: 48px;
        border-radius: 50%;
        transition: all 0.5s;
    }

    #m-leftmenu {
        overflow: hidden;
    }

    #m-leftmenu .active {
        color: #80848f;
        border-left-color: #59c993;
        background: #f2f2f2;
    }


    .menu-2CauV_0 {
        display: -webkit-box;
        display: -ms-flexbox;
        display: flex;
        -webkit-box-orient: horizontal;
        -webkit-box-direction: normal;
        -ms-flex-direction: row;
        flex-direction: row;
        -webkit-box-align: center;
        -ms-flex-align: center;
        align-items: center;
        height: 40px;
        width: 100%;
        line-height: 40px;
        color: rgba(0, 0, 0, 0.58);
        font-size: 14px;
        transition: all 0.2s ease;
        border-left: 3px solid transparent;
        position: relative;
        overflow: hidden;
        margin-bottom: 8px;
    }

    .menu-2CauV_0:hover {
        background: #f2f2f2;
        color: #80848f;
        border-left-color: #59c993;
    }

    .menu-2CauV_0 i {
        display: -webkit-inline-box;
        display: -ms-inline-flexbox;
        display: inline-flex;
        font-size: 16px;
        margin: 0 16px 0 24px;
        transition: all 0.5s;
        cursor: pointer;
    }

    .menu-2CauV_0.fold-1fF4w_0 i {
        margin-left: 20px;
        margin-right: 24px;
        transition: all 0.5s;
    }

    @media (max-width: 1600px) and (min-width: 1280px) {
        .menu-2CauV_0 {
            margin-bottom: 0;
            height: 36px;
        }
    }

    @media (max-width: 1280px) {
        .menu-2CauV_0 {
            margin-bottom: 0;
            height: 36px;
        }
    }

</style>
